#include <stdio.h>

int main() 
{
    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;
    a > 0 && a < 100000;
    b > 0 && b < 100000;
    c > 0 && c < 100000;
    d > 0 && d < 100000;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    printf("%d",(a+b-c)*d);
    return 0;
}